\(\int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx\) [673]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 52 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {1}{2} (6 c+b d) x-\frac {(b c+3 d) \cos (e+f x)}{f}-\frac {b d \cos (e+f x) \sin (e+f x)}{2 f} \]

[Out]

1/2*(2*a*c+b*d)*x-(a*d+b*c)*cos(f*x+e)/f-1/2*b*d*cos(f*x+e)*sin(f*x+e)/f

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.02, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.048, Rules used = {2813} \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=-\frac {(a d+b c) \cos (e+f x)}{f}+\frac {1}{2} x (2 a c+b d)-\frac {b d \sin (e+f x) \cos (e+f x)}{2 f} \]

[In]

Int[(a + b*Sin[e + f*x])*(c + d*Sin[e + f*x]),x]

[Out]

((2*a*c + b*d)*x)/2 - ((b*c + a*d)*Cos[e + f*x])/f - (b*d*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 2813

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(2*a*c +
 b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Cos[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} (2 a c+b d) x-\frac {(b c+a d) \cos (e+f x)}{f}-\frac {b d \cos (e+f x) \sin (e+f x)}{2 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 49, normalized size of antiderivative = 0.94 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {12 c f x+2 b d (e+f x)-4 (b c+3 d) \cos (e+f x)-b d \sin (2 (e+f x))}{4 f} \]

[In]

Integrate[(3 + b*Sin[e + f*x])*(c + d*Sin[e + f*x]),x]

[Out]

(12*c*f*x + 2*b*d*(e + f*x) - 4*(b*c + 3*d)*Cos[e + f*x] - b*d*Sin[2*(e + f*x)])/(4*f)

Maple [A] (verified)

Time = 1.04 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00

method result size
parts \(a c x -\frac {\left (d a +c b \right ) \cos \left (f x +e \right )}{f}+\frac {b d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) \(52\)
risch \(a c x +\frac {d x b}{2}-\frac {\cos \left (f x +e \right ) d a}{f}-\frac {\cos \left (f x +e \right ) c b}{f}-\frac {b d \sin \left (2 f x +2 e \right )}{4 f}\) \(53\)
parallelrisch \(\frac {-b d \sin \left (2 f x +2 e \right )+\left (-4 d a -4 c b \right ) \cos \left (f x +e \right )+\left (2 d x f +4 c \right ) b +4 a \left (f x c +d \right )}{4 f}\) \(56\)
derivativedivides \(\frac {b d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-d a \cos \left (f x +e \right )-c b \cos \left (f x +e \right )+a c \left (f x +e \right )}{f}\) \(59\)
default \(\frac {b d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-d a \cos \left (f x +e \right )-c b \cos \left (f x +e \right )+a c \left (f x +e \right )}{f}\) \(59\)
norman \(\frac {\left (a c +\frac {b d}{2}\right ) x +\left (a c +\frac {b d}{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (2 a c +b d \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\frac {\left (2 d a +2 c b \right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {b d \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {2 \left (d a +c b \right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {b d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}\) \(150\)

[In]

int((a+b*sin(f*x+e))*(c+d*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

a*c*x-(a*d+b*c)*cos(f*x+e)/f+b*d/f*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.92 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=-\frac {b d \cos \left (f x + e\right ) \sin \left (f x + e\right ) - {\left (2 \, a c + b d\right )} f x + 2 \, {\left (b c + a d\right )} \cos \left (f x + e\right )}{2 \, f} \]

[In]

integrate((a+b*sin(f*x+e))*(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

-1/2*(b*d*cos(f*x + e)*sin(f*x + e) - (2*a*c + b*d)*f*x + 2*(b*c + a*d)*cos(f*x + e))/f

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (44) = 88\).

Time = 0.10 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.81 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\begin {cases} a c x - \frac {a d \cos {\left (e + f x \right )}}{f} - \frac {b c \cos {\left (e + f x \right )}}{f} + \frac {b d x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b d x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b d \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right ) \left (c + d \sin {\left (e \right )}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*sin(f*x+e))*(c+d*sin(f*x+e)),x)

[Out]

Piecewise((a*c*x - a*d*cos(e + f*x)/f - b*c*cos(e + f*x)/f + b*d*x*sin(e + f*x)**2/2 + b*d*x*cos(e + f*x)**2/2
 - b*d*sin(e + f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*(a + b*sin(e))*(c + d*sin(e)), True))

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.10 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {4 \, {\left (f x + e\right )} a c + {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b d - 4 \, b c \cos \left (f x + e\right ) - 4 \, a d \cos \left (f x + e\right )}{4 \, f} \]

[In]

integrate((a+b*sin(f*x+e))*(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

1/4*(4*(f*x + e)*a*c + (2*f*x + 2*e - sin(2*f*x + 2*e))*b*d - 4*b*c*cos(f*x + e) - 4*a*d*cos(f*x + e))/f

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 46, normalized size of antiderivative = 0.88 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {1}{2} \, {\left (2 \, a c + b d\right )} x - \frac {b d \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} - \frac {{\left (b c + a d\right )} \cos \left (f x + e\right )}{f} \]

[In]

integrate((a+b*sin(f*x+e))*(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*a*c + b*d)*x - 1/4*b*d*sin(2*f*x + 2*e)/f - (b*c + a*d)*cos(f*x + e)/f

Mupad [B] (verification not implemented)

Time = 8.09 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00 \[ \int (3+b \sin (e+f x)) (c+d \sin (e+f x)) \, dx=a\,c\,x+\frac {b\,d\,x}{2}-\frac {a\,d\,\cos \left (e+f\,x\right )}{f}-\frac {b\,c\,\cos \left (e+f\,x\right )}{f}-\frac {b\,d\,\sin \left (2\,e+2\,f\,x\right )}{4\,f} \]

[In]

int((a + b*sin(e + f*x))*(c + d*sin(e + f*x)),x)

[Out]

a*c*x + (b*d*x)/2 - (a*d*cos(e + f*x))/f - (b*c*cos(e + f*x))/f - (b*d*sin(2*e + 2*f*x))/(4*f)